<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>测试页面</title>
    <script type="text/javascript" src="jquery-3.1.0.min.js"></script>
    <script type="text/javascript" src="jszip.js"></script>
    <script type="text/javascript" src="DDoc.js"></script>

</head>
<body>
<h1>测试生成文档</h1>
<script>
    function generate() {
        var doc = new DDoc();
        doc.addParagraph("添加一个段落");
        doc.addParagraph("添加一个段落，设置字体和大小",{
            font:"Microsoft YaHei UI",
            italic:true,
            underline:doc.UnderlineType.Wave,
            underlineColor:"FF0000",
            strike:true,
            shadow:"FFFFFF",
            textAlign:doc.AlignType.Center,
            lineHeight:3
        });
        doc.addParagraph("再添加一个段落，设置一些样式",{
            font:"Microsoft YaHei UI",
            fontSize:"44",
            bold:true,
            color:"FF0000",
            highlightColor:"blue"
        });

        doc.addHeader("标题1", doc.HeaderType.H1);
        doc.addHeader("标题2", doc.HeaderType.H2,{
            font:"Microsoft YaHei UI",
            underline:doc.UnderlineType.Double,
            color:"67ff56",
            underlineColor:"FF0000"
        });

        doc.addList(['第1章', '第2章', '第3章']);
        doc.addList(['第一章', '第二章', '第三章'],{
            color:"FF0000"
        });

        doc.addEmptyTable(4, 5);
        doc.newLine();
        doc.addTable([
            [1, 2, 3],
            [4, 5, 6],
            [7, 8, 9]
        ],{color:"FF0000"});

        doc.newLine();
        doc.addTable([
            [1, 2, 4,4,5],
            [doc.Merge.CC,3, doc.Merge.RC,5,8],
            [7, 8, 4,doc.Merge.CC,9],
            [1, 2, doc.Merge.RC,doc.Merge.CC,5]
        ]);


        var _temp="";
        doc.addImage(_temp,100,50,{
            textAlign:doc.AlignType.Center
        });

        doc.addHyperlink("Github地址","https://github.com/DistChen/DDoc.js",{
            fontSize:"30",
            bold:true
        });
        doc.generate("demo.docx");
        // or
        // doc.generate();
    }
</script>
<p><a href="javascript:generate()">生成文档</a></p>
</body>
</html>